﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using Modellayer;
using ControlLayer;

namespace BioWCF
{
    public class BioService : IBioService
    {
        private static PersonCtr personCtr = PersonCtr.getInstance();
        private static ReservationCtr reservationCtr = ReservationCtr.getInstance();
        private static ShowRoomCtr showRoomCtr = ShowRoomCtr.getInstance();
        private static ShowCtr showCtr = ShowCtr.getInstance();
        private static MovieCtr movieCtr = MovieCtr.getInstance();

        public void createEmployee(int phoneNumber, string email, string password, string name, string loginId)
        {
            personCtr.createEmployee(phoneNumber, email, password, name, loginId);
        }

        public void createCustomer(int phoneNumber, string email, string password, string name)
        {
            personCtr.createCustomer(phoneNumber, email, password, name);
        }

        public Person findPerson(int phonenumber)
        {
            return personCtr.findPerson(phonenumber);
        }

        public Person findPersonByLoginIdAndPassword(string loginId, string password)
        {
            return personCtr.findPersonByLoginIdAndPassword(loginId, password);
        }

        public void updatePerson(int phoneNumber, string name, string email, string password)
        {
            personCtr.updatePerson(phoneNumber, name, email, password);
        }

        public void deletePerson(int phoneNumber)
        {
            personCtr.deletePerson(phoneNumber);
        }

        public void createReservation(List<int> seatNumbers, int showId, int phoneNumber)
        {
            reservationCtr.createReservation(seatNumbers, showId, phoneNumber);
        }

        public void deleteReservation(int reservationId)
        {
            reservationCtr.deleteReservation(reservationId);
        }

        public Reservation findReservation(int reservationid)
        {
            return reservationCtr.findReservation(reservationid);
        }

        public int getLastMax()
        {
            return reservationCtr.getLastMax();
        }

        public void updateSeat(Seat seat)
        {
            showCtr.updateSeat(seat);
        }
        public void createShowRoom(int showRoomNumber, int numberOfSeats)
        {
            showRoomCtr.createShowRoom(showRoomNumber, numberOfSeats);
        }

        public void updateNumberOfSeats(int showRoomNumber, int numberOfSeats)
        {
            showRoomCtr.updateNumberOfSeats(showRoomNumber, numberOfSeats);
        }

        public void addDescription(int showRoomNumber, string showRoomDescription)
        {
            showRoomCtr.addDescription(showRoomNumber, showRoomDescription);
        }

        public void createShow(string showTime, ShowRoom showRoom, Movie movie)
        {
            showCtr.createShow(showTime, showRoom, movie);
        }

        public Seat findSeat(int showId, int seatNumber)
        {
            return showCtr.findSeat(showId, seatNumber);
        }

        public void unLockSeat(int showId, int seatNumber)
        {
            showCtr.unLockSeat(showId, seatNumber);
        }

        public void lockSeat(int showId, int seatNumber)
        {
            showCtr.lockSeat(showId, seatNumber);
        }

        public void reserveSeat(int showId, int seatNumber, int reservationId)
        {
            showCtr.reserveSeat(showId, seatNumber, reservationId);
        }

        public Show findShow(int showId)
        {
            return showCtr.findShow(showId);
        }

        public List<Seat> getAllSeats(int showId)
        {
            return showCtr.getAllSeats(showId);
        }

        public void createMovie(string title, string movieLength)
        {
            movieCtr.createMovie(title, movieLength);
        }

        public void updateMovie(string title, string movieLength, string description)
        {
            movieCtr.updateMovie(title, movieLength, description);
        }

        public Movie findMovie(string title)
        {
            return movieCtr.findMovie(title);
        }

        public void deleteMovie(string title)
        {
            movieCtr.deleteMovie(title);
        }

        public List<Show> findShowsByTitleAndDate(string dato, string title)
        {
            return showCtr.findShowsByTitleAndDate(dato, title);
        }

        public List<Movie> findAllMovies()
        {
            return movieCtr.findAllMovies();
        }

        public List<string> findDatesByMovie(string title)
        {
            return showCtr.findDatesByMovie(title);
        }

        public List<Show> findShowsByDate(string date)
        {
            return showCtr.findShowsByDate(date);
        }

        public List<ShowRoom> findFreeShowRoomsByDate(string date)
        {
            return showRoomCtr.findFreeShowRoomsByDate(date);
        }

        public List<ShowRoom> findAllShowRooms()
        {
            return showRoomCtr.findAllShowRooms();
        }

        public ShowRoom findShowRoom(int showroomnumber)
        {
            return showRoomCtr.findShowRoom(showroomnumber);
        }


    }
}
